home *** CD-ROM | disk | FTP | other *** search
/ Chip 1996 October / CHIP Ekim 1996.iso / winbatch / boxdemo.wb_ < prev    next >
Text File  |  1995-10-09  |  15KB  |  506 lines

  1. IntControl(12,5,0,0,0)
  2. ;colors
  3. DKBLUE="0,0,128"
  4. BLUE="0,0,255"
  5. LTGRAY="192,192,192"
  6. GRAY="128,128,128"
  7. DKGRAY="64,64,64"
  8. GREEN="0,255,0"
  9. RED="255,0,0"
  10. BLACK="0,0,0"
  11. WHITE="255,255,255"
  12. YELLOW="255,255,0"
  13.  
  14.  
  15. while 1
  16.  
  17.    BoxColor(1,"0,0,128",4)
  18.    BoxesUp("100,100,900,900",@NORMAL)
  19.    BoxCaption(1,"Boxes, Boxes everywhere, and not a box to think!")
  20.    bDraw=1
  21.    bLines=2
  22.    bBoxes=3
  23.    bDots=4
  24.    bExit=5
  25.    bText=6
  26.    bTherm=7
  27.    
  28.  
  29.    BoxButtonDraw(1,bDraw,    "&Draw",  "25,10,175,70")                                                                                          
  30.    BoxButtonDraw(1,bLines,   "&Lines", "225,10,375,70")
  31.    BoxButtonDraw(1,bBoxes,   "&Boxes", "425,10,575,70")
  32.    BoxButtonDraw(1,bDots,    "&Spots",  "625,10,775,70")
  33.    BoxButtonDraw(1,bExit,    "E&xit",  "825,10,975,70")
  34.    BoxButtonDraw(1,bText,    "&Text",  "25,100,175,160")
  35.    BoxButtonDraw(1,bTherm,   "Thermo&meter Bar",  "225,100,575,160")
  36.    BoxDrawRect(1,"0,0,1000,1000",2)
  37.  
  38.    BoxTextFont(1,"",100,0,0)
  39.    BoxTextColor(1,"255,255,0")
  40.    BoxDrawText(1,"0,0,1000,1000","Pick a Demo",0,5)
  41.  
  42.    bWho=0
  43.    BoxButtonWait()
  44.    while bWho==0
  45.       for x=1 to 7
  46.          if BoxButtonStat(1,x) then bWho=x
  47.       next
  48.    end while
  49.     
  50.    if bWho
  51.       BoxDataClear(1,"TOP")
  52.       switch bWho
  53.          case bDraw
  54.             gosub DoDraw
  55.             break
  56.          case bLines
  57.             gosub DoLines
  58.             break
  59.          case bBoxes
  60.             gosub DoBoxes
  61.             break
  62.          case bDots
  63.             gosub DoDots
  64.             break
  65.          case bExit
  66.             exit
  67.             break
  68.          case bText
  69.             gosub DoText
  70.             break
  71.          case bTherm
  72.             gosub DoTherm
  73.             break
  74.    
  75.       end switch
  76.  
  77.    endif
  78. end while
  79. exit
  80. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  81. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  82. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  83. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  84.  
  85. :DODRAW
  86. BoxCaption(1,"Scribble")
  87. BoxNew(2,"0,0,1000,1000",0)
  88. BoxPen(2,RED,1)
  89. BoxButtonDraw(2,8,"Exit","50,50,200,120")
  90. BoxDataTag(2,"FRED")
  91. Exclusive(@ON)
  92. olda="500,500"
  93. while 1
  94.    BoxDataClear(2,"FRED")
  95.    a=MouseInfo(6)
  96.    a=strreplace(a," ",",")
  97.    BoxDrawLine(2,"%olda%,%a%")
  98.    olda=a
  99.    if BoxButtonStat(2,8)==1 then break
  100. endwhile
  101. BoxDestroy(2)
  102. return
  103.  
  104. :DOLINES
  105. BoxCaption(1,"That Old Line")
  106. BoxNew(2,"0,0,1000,1000",0)
  107. BoxColor(2,BLACK,0)
  108. BoxDrawRect(2,"0,0,1000,1000",2)
  109. BoxButtonDraw(2,8,"Exit","50,50,200,120")
  110. BoxDataTag(2,"APPLE")
  111.  
  112. p1=200
  113. p2=200
  114. p3=400
  115. p4=400
  116.  
  117. v1=10
  118. v2=-20
  119. v3=-5
  120. v4=15
  121.  
  122. bb=1
  123. ErrorMode(@OFF)
  124. while 1
  125.    if BoxButtonStat(2,8)==1 then break
  126.    if LastError()==10108
  127.       BoxDataClear(2,"APPLE")
  128.       BoxPen(2,"%r%,%g%,%b%",1)
  129.    endif
  130.    if bb==1
  131.       BoxDataClear(2,"APPLE")
  132.       gosub randcolor
  133.       BoxPen(2,"%r%,%g%,%b%",1)
  134.       bb=0
  135.    endif
  136.    BoxDrawLine(2,"%p1%,%p2%,%p3%,%p4%")
  137.    bb=0
  138.    for q=1 to 4
  139.        p%q%=p%q%+v%q%
  140.        if p%q% <= 0
  141.           p%q%=0
  142.           v%q%=Int(Random(10))+1
  143.           bb=1
  144.        endif
  145.        if p%q% >= 1000
  146.           p%q%=1000
  147.           v%q%=-Int(Random(10))-1
  148.           bb=1
  149.        endif
  150.    next
  151. endwhile
  152. BoxDestroy(2)
  153. return
  154.  
  155. :DOBOXES
  156. BoxCaption(1,"Random Rectangles")
  157. BoxNew(2,"0,0,1000,1000",0)
  158. BoxButtonDraw(2,8,"Exit","50,50,200,120")
  159. BoxDataTag(2,"ACORN")
  160. ErrorMode(@OFF)
  161. while 1
  162.    if BoxButtonStat(2,8)==1 then break
  163.    x=Random(1000)
  164.    y=Random(1000)
  165.    s=Random(1000)
  166.    t=Random(1000)
  167.    r=Random(255)
  168.    g=Random(255)
  169.    b=Random(255)
  170.    BoxColor(2,"%r%,%g%,%b%",0)
  171.    BoxDrawRect(2,"%x%,%y%,%s%,%t%",2)   ; Bug here on 1
  172.    if LastError()==10108
  173.        BoxDataClear(2,"ACORN")
  174.        BoxUpdates(1,3)
  175.    endif
  176. endwhile
  177. ErrorMode(@CANCEL)
  178. BoxDestroy(2)
  179. return
  180.  
  181. :DODOTS
  182. BoxCaption(1,"Driving Me Dotty")
  183. BoxNew(2,"0,0,1000,1000",0)
  184. BoxButtonDraw(2,8,"Exit","50,50,200,120")
  185. BoxColor(2,BLACK,0)
  186. BoxDrawRect(2,"0,0,1000,1000",2)
  187. brk=0
  188. x=500
  189. y=500
  190. oldxx=0
  191. oldyy=0
  192. z=5
  193. z2=10
  194. BoxDataTag(2,"SAM")
  195. while 1
  196.    BoxDataClear(2,"SAM")
  197.    gosub RandColor
  198.    BoxColor(2,"%r%,%g%,%b%",0)
  199.    for q=1 to 100
  200.      x1=x-z
  201.      x2=x+z
  202.      y1=y-z
  203.      y2=y+z
  204.      BoxDrawCircle(2,"%x1%,%y1%,%x2%,%y2%",2)
  205.      ww=Int(Random(100))
  206.      if ww>16
  207.         xx=oldxx
  208.         yy=oldyy
  209.      else
  210.         xx=ww&3
  211.         if xx==3 then xx=0
  212.         yy=(ww&12)>>2
  213.         if yy==3 then yy=0
  214.      endif
  215.      
  216.      if x<=0 then xx=2
  217.      if x>=1000 then xx=1
  218.      if y<=0 then yy=2
  219.      if y>=1000 then yy=1
  220.      oldxx=xx
  221.      oldyy=yy
  222.      if xx==2 then x=x+z2
  223.      if xx==1 then x=x-z2
  224.      if yy==2 then y=y+z2
  225.      if yy==1 then y=y-z2
  226.    if BoxButtonStat(2,8)==1
  227.       brk=1
  228.       break
  229.    endif
  230.    next
  231.    if brk==1 then break
  232. endwhile
  233. BoxDestroy(2)
  234. return
  235.  
  236. :DOTEXT
  237.         BoxCaption(1,"Fontopia")
  238.         BoxNew(2,"0,0,1000,500",0)
  239.         BoxColor(2,LTGRAY,2)
  240.         BoxColor(1,LTGRAY,0)
  241.         BoxButtonDraw(2,8,"Exit","50,50,200,200")
  242.         BoxDrawRect(2,"0,0,1000,1000",2)
  243.         BoxDrawRect(1,"0,500,1000,1000",2)
  244.         words="The quick brown fox went happy stroll dark woods looking for something tasty dinner soon found picnic basket full yummy goodies "
  245.         wc=ItemCount(words," ")
  246.         BoxTextColor(1,BLACK)
  247.          ;;;;;;;;;
  248.         BoxTextFont(1,"",20,0,0)
  249.         BoxTextColor(1,RED)
  250.         BoxDrawText(1,"25,510,1000,545","Results shown will vary with installed fonts...",0,0)
  251.         BoxTextColor(1,BLACK)
  252.         fonttype=0
  253.         xxx=25
  254.         yyy=xxx+225
  255.         BoxTextFont(1,"",30,fonttype,0)
  256.         BoxDrawText(1,"%xxx%,550,%yyy%,600","Normal",0,0)
  257.         BoxTextFont(1,"Times New Roman",30,fonttype,4)
  258.         BoxDrawText(1,"%xxx%,625,%yyy%,675","Times New Roman",0,0)
  259.         BoxTextFont(1,"Arial",30,fonttype,8)
  260.         BoxDrawText(1,"%xxx%,700,%yyy%,750","Arial",0,0)
  261.         BoxTextFont(1,"Modern",30,fonttype,12)
  262.         BoxDrawText(1,"%xxx%,775,%yyy%,825","Modern",0,0)
  263.         BoxTextFont(1,"Script",30,fonttype,16)
  264.         BoxDrawText(1,"%xxx%,850,%yyy%,900","Script",0,0)
  265.         BoxTextFont(1,"Old English Text MT",30,fonttype,22)
  266.         BoxDrawText(1,"%xxx%,925,%yyy%,975","Old English",0,0)
  267.         fonttype=100
  268.         xxx=275
  269.         yyy=xxx+225
  270.         BoxTextFont(1,"",30,fonttype,0)
  271.         BoxDrawText(1,"%xxx%,550,%yyy%,600","Italic",0,0)
  272.         BoxTextFont(1,"Times New Roman",30,fonttype,4)
  273.         BoxDrawText(1,"%xxx%,625,%yyy%,675","Times New Roman",0,0)
  274.         BoxTextFont(1,"Arial",30,fonttype,8)
  275.         BoxDrawText(1,"%xxx%,700,%yyy%,750","Arial",0,0)
  276.         BoxTextFont(1,"Modern",30,fonttype,12)
  277.         BoxDrawText(1,"%xxx%,775,%yyy%,825","Modern",0,0)
  278.         BoxTextFont(1,"Script",30,fonttype,16)
  279.         BoxDrawText(1,"%xxx%,850,%yyy%,900","Script",0,0)
  280.         BoxTextFont(1,"Old English Text MT",30,fonttype,20)
  281.         BoxDrawText(1,"%xxx%,925,%yyy%,975","Old English",0,0)
  282.         fonttype=70
  283.         xxx=525
  284.         yyy=xxx+225
  285.         BoxTextFont(1,"",30,fonttype,0)
  286.         BoxDrawText(1,"%xxx%,550,%yyy%,600","Bold",0,0)
  287.         BoxTextFont(1,"Times New Roman",30,fonttype,4)
  288.         BoxDrawText(1,"%xxx%,625,%yyy%,675","Times New Roman",0,0)
  289.         BoxTextFont(1,"Arial",30,fonttype,8)
  290.         BoxDrawText(1,"%xxx%,700,%yyy%,750","Arial",0,0)
  291.         BoxTextFont(1,"Modern",30,fonttype,12)
  292.         BoxDrawText(1,"%xxx%,775,%yyy%,825","Modern",0,0)
  293.         BoxTextFont(1,"Script",30,fonttype,16)
  294.         BoxDrawText(1,"%xxx%,850,%yyy%,900","Script",0,0)
  295.         BoxTextFont(1,"Old English Text MT",30,fonttype,20)
  296.         BoxDrawText(1,"%xxx%,925,%yyy%,975","Old English",0,0)
  297.         fonttype=170
  298.         xxx=775
  299.         yyy=xxx+225
  300.         BoxTextFont(1,"",30,fonttype,0)
  301.         BoxDrawText(1,"%xxx%,550,%yyy%,600","Bold Italic",0,0)
  302.         BoxTextFont(1,"Times New Roman",30,fonttype,4)
  303.         BoxDrawText(1,"%xxx%,625,%yyy%,675","Times New Roman",0,0)
  304.         BoxTextFont(1,"Arial",30,fonttype,8)
  305.         BoxDrawText(1,"%xxx%,700,%yyy%,750","Arial",0,0)
  306.         BoxTextFont(1,"Modern",30,fonttype,12)
  307.         BoxDrawText(1,"%xxx%,775,%yyy%,825","Modern",0,0)
  308.         BoxTextFont(1,"Script",30,fonttype,16)
  309.         BoxDrawText(1,"%xxx%,850,%yyy%,900","Script",0,0)
  310.         BoxTextFont(1,"Old English Text MT",30,fonttype,20)
  311.         BoxDrawText(1,"%xxx%,925,%yyy%,975","Old English",0,0)
  312.         
  313.         
  314.         BoxDataTag(2,"PEACHY")
  315.         brk=0
  316.         cnt=0
  317.         wash=0
  318.         while 1
  319.            for i=1 to wc
  320.                 cnt=cnt+1
  321.                 gosub randcolor
  322.                 BoxTextColor(2,"%r%,%g%,%b%")
  323.                 ;gosub randcolor
  324.                 ;BoxColor(2,"%r%,%g%,%b%",0)
  325.                 x=Random(800)
  326.                 y=Random(800)
  327.                 s=x+Random(200)
  328.                 t=y+Random(200)
  329.                 fontsize=max(10,min(t-y,Random(200)))
  330.                 BoxTextFont(2, "", fontsize, 10+Random(80)+ (100*Int(Random(1))), (Int(Random(4)+1)*4 ))
  331.                 BoxDrawText(2,"%x%,%y%,%s%,%t%",ItemExtract(i,words," "),0,0)
  332.                 if BoxButtonStat(2,8)
  333.                     brk=1
  334.                     break
  335.                 endif
  336.                 if cnt==200
  337.                    cnt=0
  338.                    wash=wash+1
  339.                    if wash==8 then wash=0
  340.                    BoxColor(2,"%r%,%g%,%b%",wash)
  341.                    BoxDrawRect(2,"0,0,1000,1000",2)
  342.                 endif
  343.            next i
  344.            BoxDataClear(2,"PEACHY")
  345.            if brk then break
  346.         endwhile
  347.         BoxDestroy(2)
  348. return
  349.  
  350. :DOTHERM
  351. rectutext="100,100,1000,900"
  352. rectTherm="200,350,800,650"
  353. rectButton="0,0,100,100"
  354. ;rectThermDone='"100,550,%%xxx%%,800"'
  355. ;rectThermLeft='"%%xxx%%,550,900,800"'
  356. rectThermLine1="100,550,900,550"
  357. rectThermLine2="900,550,900,800"
  358. rectThermLine3="900,800,100,800"
  359. rectThermLine4="100,800,100,550"
  360. ThermPenWidth=20
  361. rectThermText1="100,50,1000,199"
  362. rectThermPercent="490,625,550,725"
  363. rectTopHalf="0,0,1000,210"
  364. rectBotHalf="0,210,1000,1000" 
  365. rectTitle="100,50,900,200"
  366. rectTitleText="10,10,790,140"
  367. TitleHeight=950
  368. rectNote="250,850,750,925"
  369. NoteHeight=400
  370. rectNoteText="70,200,950,800"
  371.  
  372. rectnoteline1="0,0,1000,0"
  373. rectNoteline2="1000,1000,1000,0"
  374. rectNoteLine3="0,1000,1000,1000"
  375. rectNoteLine4="0,0,0,1000"
  376. notepenwidth=120
  377. rectnoteline1b="40,150,960,150"
  378. rectNoteline2b="960,840,960,150"
  379. rectNoteLine3b="40,840,960,840"
  380. rectNoteLine4b="40,150,40,840"
  381. notepenwidthb=50
  382. wbid=2
  383. Thermid=3
  384. Noteid=4
  385.         ; Make main window look nice
  386.         BoxColor(1,"128,0,0",1)
  387.         BoxDrawRect(1,"0,0,1000,1000",2)
  388.         BoxCaption(1,"Are we making any progress here?")
  389.         
  390.         ;Get title on screen
  391.         BoxNew(wbid,rectTitle,1)
  392.         BoxColor(wbid,BLACK,0)
  393.         BoxDrawRect(wbid,"0,0,1000,1000",2)
  394.         BoxTextFont(wbid,"Arial",TitleHeight,170,0)   ; san-srif, ariel, size 20, bold, noitalic
  395.         BoxTextColor(wbid,RED)
  396.         BoxDrawText(wbid,rectTitleText,"Acme Aardvarks",0,32)
  397.         
  398.         ;Do note box
  399.         BoxNew(Noteid,rectNote,1)
  400.         BoxColor(Noteid,LTGRAY,0)       ; Light Gray no gradient
  401.         BoxDrawRect(Noteid,"",2)
  402.         BoxTextFont(Noteid,"Arial",NoteHeight,0,0)   ; san-srif, ariel, size 12, nobold, noitalic
  403.         ;BoxTextRect(Noteid,rectNoteText)
  404.         BoxTextColor(Noteid,RED)
  405.         
  406.         BoxPen(Noteid,WHITE,notepenwidth)
  407.         boxdrawline(Noteid,rectNoteLine1)
  408.         boxdrawline(Noteid,rectNoteLine4)
  409.         BoxPen(Noteid,GRAY,notepenwidth)
  410.         boxdrawline(Noteid,rectNoteLine2)
  411.         boxdrawline(Noteid,rectNoteLine3)
  412.         BoxPen(Noteid,WHITE,notepenwidthb)
  413.         boxdrawline(Noteid,rectNoteLine2b)
  414.         boxdrawline(Noteid,rectNoteLine3b)
  415.         BoxPen(Noteid,GRAY,notepenwidthb)
  416.         boxdrawline(Noteid,rectNoteLine1b)
  417.         boxdrawline(Noteid,rectNoteLine4b)
  418.         
  419.         BoxDataTag(Noteid,"NOTE")
  420.         ;BoxDataClear(Noteid,"NOTE")
  421.         BoxDrawText(Noteid,rectNoteText,"Initializing...",1,4)
  422.         
  423.         
  424.         
  425.         ;Draw thermoneter outline
  426.         BoxNew(Thermid,rectTherm,2)
  427.         BoxUpdates(Thermid,0)
  428.         BoxCaption(Thermid,"Acme Aardvark Association")
  429.         BoxColor(Thermid,LTGRAY,0)
  430.         BoxDrawRect(Thermid,"",2)
  431.         ; Draw updating thermometer here
  432.         ; there are 3 virtual pixels per percent
  433.         ; we have to draw 3 boxes and some text...
  434.         BoxDataTag(Thermid,"FRED")
  435.         BoxCaption(Thermid,"Please wait. Function in progress")
  436.         
  437.         FilesToCopy=16
  438.         FilesCopied=0
  439.         
  440.         for FilesCopied=1 to FilesToCopy
  441.            BoxDataClear(Thermid,"FRED")
  442.            BoxUpdates(Thermid,0)
  443.            BoxColor(Thermid,GREEN,0)
  444.            xxx= 100+((800*FilesCopied)/FilesToCopy)
  445.            per=(100.0*FilesCopied)/FilesToCopy
  446.            per=Int(per)
  447.            ;rectThermDone='"100,550,%%xxx%%,800"'
  448.            ;rectThermLeft='"%%xxx%%,550,900,800"'
  449.            BoxDrawRect(Thermid,"104,554,%xxx%,796",2)
  450.            BoxColor(Thermid,GRAY,0)
  451.            BoxDrawRect(Thermid,"%xxx%,554,896,796",2)
  452.            BoxPen(Thermid,BLACK,ThermPenWidth)
  453.            boxdrawline(Thermid,rectThermLine1)
  454.            boxdrawline(Thermid,rectThermLine2)
  455.            boxdrawline(Thermid,rectThermLine3)
  456.            boxdrawline(Thermid,rectThermLine4)
  457.            
  458.            if per<50 then BoxTextColor(Thermid,WHITE)
  459.            BoxDrawText(Thermid,rectThermPercent,"%per%%%",0,0)
  460.            BoxTextColor(Thermid,BLACK)
  461.            BoxColor(Thermid,LTGRAY,0)
  462.            BoxDrawText(Thermid,rectThermText1,"Mooshing Object number %FilesCopied%",1,0)
  463.            BoxDataClear(NoteId,"NOTE")
  464.            BoxDrawText(Noteid,rectNoteText,"Working on Object number %FilesCopied%",1,4)
  465.            BoxUpdates(Thermid,2)
  466.            TimeDelay(Random(1.0))   ;Fake passage of time
  467.         next
  468.         Message("Acme Aardvark Association","Mooshing Complete!!")
  469.         BoxDestroy(wbid)
  470.         BoxDestroy(Thermid)
  471.         BoxDestroy(Noteid)
  472. return
  473.  
  474. :RANDCOLOR
  475.         r=Int(Random(255))
  476.         g=Int(Random(255))
  477.         b=Int(Random(255))
  478.         q=min(r,g,b)
  479.         if q==r then r=0
  480.         if q==g then g=0
  481.         if q==b then b=0
  482.         q=max(r,g,b)
  483.         if q==r then r=255
  484.         if q==g then g=255
  485.         if q==b then b=255
  486.       
  487. return
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.